<template>
  <div>
    <search @add="handleOpenDialog" @search="handleSearchByKeyword" row-key="${searchId}" />
    <ms-table :table-props="tableProps" :data-api="dataUrl" ref="dataTable">
      <el-table-column label="操作" slot="tool">
        <template slot-scope="scope">
          <el-button
            size="mini"
            v-permission="['${changeClassName}:save']"
            @click="handleOpenDialog(scope.row.${searchId})">编辑</el-button>
          <el-button
            size="mini"
            type="danger"
            v-permission="['${changeClassName}:del']"
            >删除</el-button>
        </template>
      </el-table-column>
    </ms-table>
    <info ref="infoForm" :title="title" :dialog-visible="dialog1" :form-id="formId" @dataFresh="handleCanleDialog" @close="handleCanleDialog" />
  </div>
</template>

<script>
import { MsTable } from '@/common/table'
import Info from './Info'
import Search from './Search'
import common from '@/mixins/common'
export default {
  components: {
    MsTable,
    Info,
    Search
  },
  mixins: [common],
  data() {
    return {
      tableProps: [
        <#if tables??>
        <#list tables as column>
        { index: '${column.colName}', label: '${column.label}'<#if column.formType?? && column.formType = "dict">, dict: '${column.dictValue}'</#if> }<#if column_has_next>, </#if>
        </#list>
        </#if>
      ],
      dataUrl: '/${package}/${changeClassName}/list',
      mainTitle: '${apiAlias}'
    }
  }
}
</script>
